#pragma once
#include <string>
#include <unordered_map>
using namespace std;

static string WORKDIR = "../";

static string cppPos = ".cpp";
static string jsPos = ".js";
static string usercodeFileNameMid = "usercode";

static string UserInputPos = "userinput.txt";

static string RunOutPos = "main.out";
static string RunErrorInfoPos = "runerror.txt";
static string RunTimePos = "runtime.txt";
static string RunMemoryPos = "runmemory.txt";
static string RunInputPos = "runinput.txt";
static string RunRealansPos = "runrealans.txt";
static string RunRightansPos = "runrightans.txt";
static string RunOutputInfoPos = "runoutputinfo.txt";

//return code by usercode.cpp / usercode.js inner execlp(of (cpp_judgesystem(backend):child)), catched by cpp_judgesystem(backend):parent
//JSBC means: cpp_judgesystem(backend):child
const int GBL_JSBC_RUNTEST_OK = 0x00;
const int GBL_JSBC_RUNTEST_OVERFLOW = 0x01;  //special: return by addresssanitizer or node directedly when run usercode!
const int GBL_JSBC_RUNTEST_ERROR_PARA = 0x02;
const int GBL_JSBC_RUNTEST_INPUT_NOTFOUND = 0x03;
const int GBL_JSBC_RUNTEST_INPUT_DATA_INVALID = 0x04;
const int GBL_JSBC_RUNTEST_OUTPUT_CANNOT_SAVE = 0x05;
const int GBL_JSBC_RUNTEST_WA = 0x06;
const int GBL_JSBC_RUNTEST_DEBUG = 0x07;

//return by cpp_judgesystem(backend):child outer execlp, catched by cpp_judgesystem(backend):parent
//JSBC means: cpp_judgesystem(backend):child
//note: the next group is the same group with the previous group, they both catched by cpp_judgesystem(backend):parent
const int GBL_JSBC_JUDGE_CHILD_ERROR_SET_LM_STACK = 0x10;
const int GBL_JSBC_JUDGE_CHILD_ERROR_SET_LM_CPU = 0x11;
const int GBL_JSBC_JUDGE_CHILD_ERROR_SET_LM_FSIZE = 0x12;
const int GBL_JSBC_JUDGE_CHILD_ERROR_FIRST_DUP2 = 0x13;     //useless now
const int GBL_JSBC_JUDGE_CHILD_ERROR_SECOND_DUP2 = 0x14;    //useless now
const int GBL_JSBC_JUDGE_CHILD_ERROR_EXECLP = 0x15;
const int GBL_JSBC_JUDGE_CHILD_ERROR_DEBUG = 0x16;


//return by cpp_judgesystem(backend):parent inner execlp(of (pj_taskExec: runFile:child)),catched by pj_taskExec: runFile:parent
//JSBP means: cpp_judgesystem(backend):parent
const int GBL_JSBP_RES_TLE = 0x20;
const int GBL_JSBP_RES_OF = 0x21;
const int GBL_JSBP_RES_MLE = 0x22;
const int GBL_JSBP_RES_RE = 0x23;
const int GBL_JSBP_RES_DEBUG = 0x24;
const int GBL_JSBP_RES_WA = 0x25;
const int GBL_JSBP_RES_AC = 0x26;
const int GBL_JSBP_RES_UNKNOWN = 0x27;
const int GBL_JSBP_RES_ERROR = 0x28;

//return by pj_taskExec: runFile:child outer execlp, catched by pj_taskExec: runFile:parent
//JSBP means: cpp_judgesystem(backend):parent
const int GBL_JSBP_OUTER_ERROR_PARA = 0x30;
const int GBL_JSBP_OUTER_ERROR_FORK = 0x31;
const int GBL_JSBP_OUTER_ERROR_WAIT_CHILD = 0x32;
const int GBL_JSBP_OUTER_ERROR_UNKNOWN_CHILD = 0x33;
const int GBL_JSBP_OUTER_ERROR_SAVE_INFO = 0x34;
const int GBL_JSBP_OUTER_ERROR_READ_OUTPUT = 0x35;
const int GBL_JSBP_OUTER_ERROR_DEBUG = 0x36;
const int GBL_JSBP_EXECLP_ERROR = 0x37;
const int GBL_JSBP_EXECLP_DUMP = 0x38;
